<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<div class="ImportPictureDivc" id="ImportPictureDiv" title="上传图片" style="display: none;" >
	<form action="#" id="ImportPicturefm" method="post" enctype="multipart/form-data"  name="ImportPicturefm">
	<input type="hidden" name="id" id="uploadPictureId" value=0>
	<input type="hidden" name="uploadUrl" id="uploadUrl" value="">
	<input type="hidden" name="myUploadPictureUrl" id="myUploadPictureUrl" value="#">
		<table > 
			<tr>
 				<td width="25%"> 
 					<label>导入图片：</label>  
 				</td>
				<td> 
					<input type="file" name="formFile" id="formFilePicture" class="formFile"/> 
				</td>
  			</tr>
		</table>
	</form>
</div>
<script type="text/javascript">
<!--

$(function(){


		$("#ImportPictureDiv").dialog({
		autoOpen : false,
		height : 200,
		width : 450,
		modal : true,
		buttons : {
			"提 交" : function() {

				$.ajaxFileUpload
				(
					{
						url:$("#myUploadPictureUrl").val(), 
						type: 'post',
						secureuri:false,
						data: { "id": $("#uploadPictureId").val() },
						fileElementId:'formFilePicture',//formFile
						dataType: 'JSON',
						success: function (data, status)
						{     
							var s = eval("("+data+")");
							if (s.result==1) {
								$("#ImportPictureDiv").dialog("close");
								alert("上传成功！");
								//query();
								if($("#uploadUrl").val()==""){
								   window.location.reload();
								}else{
								  window.location = $("#uploadUrl").val();
								}
								
							}
							else {
								alert(""+s.errorMessage);
							}
						},
						error: function (data, status, e)
						{
							alert("e:"+e);
						}
					}
				);
			},
			"取 消" : function() {
				$(this).dialog("close");
			}
		},
		close : function() {
			$(".formFile").val("").removeClass("ui-state-error");
		}
	});

});
//-->
</script>